package com.gxuwz.com_property.index.controller;

import com.gxuwz.com_property.common.dto.ResponseDto;
import com.gxuwz.com_property.index.pojo.Index;
import com.gxuwz.com_property.index.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {

    @Autowired
    private IndexService indexService;

    @Autowired
    private Index index;

    @PostMapping("/index/count")
    public ResponseDto getTotalsCount(){
        Integer totalUsersCount = indexService.getTotalUsersCount();
        Integer totalRepairCount = indexService.getTotalRepairCount();
        Integer totalBusineesCount = indexService.getTotalBusineesCount();
        Integer totalNoticeeCount = indexService.getTotalNoticeeCount();

        index.setCountUser(totalUsersCount);
        index.setCountRepair(totalRepairCount);
        index.setCountBusinees(totalBusineesCount);
        index.setCountNoticee(totalNoticeeCount);


        return ResponseDto.success("数量查询成功",index);
    }

}
